home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 306 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.7 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: penewson@novice.uwaterloo.ca (Paul Newson)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: basic_string& operator=(const basic_string&
  5. Date: 06 Feb 1996 16:47:26 PST
  6. Organization: -
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <199602062335.SAA13298@novice.uwaterloo.ca>
  9. NNTP-Posting-Host: isolde.mti.sgi.com
  10. Content-Type: text/plain; charset="us-ascii"
  11. X-Original-Date: Tue, 06 Feb 1996 18:36:06 -0500
  12. X-Sender: penewson@novice.uwaterloo.ca
  13. X-Mailer: Windows Eudora Version 1.4.4
  14. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  15.     iQBVAwUBMRf23Uy4NqrwXLNJAQEs3wIAtbk0XDibeEqZjIITc+dNLrgDh74h6Ost
  16.     9uEOEvqGlBLkdiEIzexRjed38yqve3wt32X5aNd8Q0vubm602nTNPw==
  17.     =NZ8J
  18. Originator: austern@isolde.mti.sgi.com
  19.  
  20. >The following was taken from a copy of the DWP:
  21. >
  22. >  basic_string<charT,traits,Allocator>&
  23. >      operator=(const basic_string<charT,traits,Allocator>& str);
  24. >
  25. >  Effects:
  26. >    If *this and str are not the same object, modifies *this such that:
  27. >
  28. >                      Table 7--operator=(str) effects
  29. >
  30. >             +-------------------------------------------------+
  31. >             | Element                    Value                |
  32. >             +-------------------------------------------------+
  33. >             |data()       points at the first element  of  an |
  34. >             |             allocated  copy  of  the  the array |
  35. >             |             whose first element is  pointed  at |
  36. >             |             by str.size()                       |
  37. >             |size()       str.size()                          |
  38. >             |capacity()   a value at least as large as size() |
  39. >             +-------------------------------------------------+
  40. >    If *this and str are the same object, the member has no effect.
  41. >  Returns:
  42. >    *this
  43. >
  44. >Aside from a seeming typographical error in the Value column for Element data()
  45. >(... by str.data() ?) the wording of this seems to rule out a counted pointer
  46. >representation.
  47. >
  48. >Is my interpretation correct?
  49. >
  50. >-- 
  51. >John Hickin      Bell-Northern Research, Montreal, Quebec
  52. >(514) 765-7924   hickin@bnr.ca
  53. >---
  54.  
  55. Because str.data() is a member function, a counted pointer implementation of
  56. the string class could perform a copy on write at the time of the call to
  57. str.data(). Member functions to return constant iterators, for example, need
  58. not cause the string to be copied, so a counted pointer implementation of
  59. the string class could still be written.  (At least, the definition of
  60. str.data() does not rule it out, there might be something else that does.)
  61.  
  62. Paul Newson
  63. penewson@novice.uwaterloo.ca
  64. ---
  65. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  66.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  67.   in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  68.